﻿using Newtonsoft.Json.Linq;
using System;
using System.IO;
using System.Web;
using System.Web.Http;
using WebApi.Services;

namespace WebApi.Controllers
{
    [RoutePrefix("api/Admin/Orders")]
    public class OrderController : ApiController
    {
        [Route("OrderInfo"), HttpGet]
        public JObject OrderInfo()
        {
            var req = HttpContext.Current.Request;
            return MyOrders.GetOrder(req["ord_id"]);
        }


        [Route("orderlist"), HttpGet]
        public JArray OrderList()
        {
            return MyOrders.OrdersList();
        }

        [Route("ChangeState"), HttpGet]
        public Boolean ChangeState()
        {
            var req = HttpContext.Current.Request;
            MyGoods.ChangeGoods(int.Parse(req["pro_id"]), req["pro_name"], req["pro_type"], req["pro_unit"], req["pro_label1"], req["pro_label2"], int.Parse(req["pro_rank"]), int.Parse(req["pro_state"]), req["pro_activity"], decimal.Parse(req["pro_ratio"]), decimal.Parse(req["pro_dprice"]), req["pro_describe"], req["pro_pic"]);
            return true;
        }


        //模糊查询
        [Route("OrderFuzzy"), HttpGet]
        public JArray CustomerFuzzy()
        {
            var req = HttpContext.Current.Request;
            return MyOrders.FuzzySearch(req["searchText"]);
        }

    }
}


